/* 
 * Project: colobok
 * and open the template in the editor.
 * @author: Sviatoslav Mysachenko <svyatoslavik@gmail.com>
 */


var MapDataManager=(function(){
  function getByBounds(bounds, callback){
      return $.getJSON('/ajax/map/bounds/', {
                    swLat: bounds.getSouthWest().lat(),
                    swLng: bounds.getSouthWest().lng(),
                    neLat: bounds.getNorthEast().lat(),
                    neLng: bounds.getNorthEast().lng()
       }, callback );
  }
  function saveModel(data, callback){
      $.ajax({
         url: '/ajax/map/savemodel/',
         type: 'post',
         data:data,
         dataType:'json',
         success:callback
      });
  }
  
  return {
      getByBounds:getByBounds,
      saveModel:saveModel
  }  
}());